Skip to content

fix(snapshots): serve zeronet from the API again, hide it only in the UI - #46

Merged
montycheese merged 3 commits into
mainfrom
fix/snapshots-restore-zeronet-api
Aug 5, 2026
Merged

fix(snapshots): serve zeronet from the API again, hide it only in the UI#46
montycheese merged 3 commits into
mainfrom
fix/snapshots-restore-zeronet-api

Conversation

@montycheese

@montycheese montycheese commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

The bug

We wanted zeronet hidden from the snapshots page. #14 "Cobalt and fixes" (2026-07-22) removed it from the page — but it also deleted the chain descriptor from app/snapshots/r2.ts, which is what /api/snapshots enumerates.

Net effect: ?network=zeronet has been returning 400 Unknown network, and the all-networks response omits it. Zeronet nodes can no longer sync from a snapshot.

The fix

Restore the descriptor, and make visibility an explicit concern separate from what we serve:

  • NetworkConfig gains hiddenFromUi, set only on zeronet.
  • isNetworkVisibleInUi() is applied in app/snapshots/page.tsx — at the render boundary, so hidden networks never reach the client, and the data layer stays untouched.
  • Sample data carries zeronet again so the dev fallback mirrors the API and the filter is actually exercised locally.

The R2 bucket and public URL are restored to their original values (base-zeronet-reth-v2-snapshots, https://zeronet-v2-snapshots.base.org).

Verification

  • typecheck, lint, test (32), build, docs:check all pass
  • /snapshots renders Base Mainnet and Base Sepolia, zero occurrences of "Base Zeronet" — while zeronet is present in the underlying data
  • ?network=zeronet is accepted (fails only on missing local creds) where it previously returned 400 Unknown network
  • ?network=bogus still correctly returns 400
  • 4 new tests: zeronet in NETWORK_IDS, not visible in UI, public networks still visible, unknown network defaults to visible

"Cobalt and fixes" (#14) removed zeronet to take it off the snapshots page, but
it deleted the chain descriptor from app/snapshots/r2.ts as well. That also
stopped /api/snapshots serving it — ?network=zeronet has been answering
400 Unknown network — so zeronet nodes can no longer sync from a snapshot.

Restore the descriptor and make visibility a separate, explicit concern:

- NetworkConfig gains `hiddenFromUi`, set on zeronet. The data layer keeps
  serving every network; only the page filters.
- isNetworkVisibleInUi() is applied in app/snapshots/page.tsx, at the render
  boundary, so hidden networks never reach the client.
- Sample data carries zeronet again, so the dev fallback mirrors what the API
  returns and the filter is exercised locally.
- Tests cover both halves: zeronet is in NETWORK_IDS but not visible in the UI,
  and an unrecognized network defaults to visible so a future network is not
  hidden by accident.

Deployment prerequisite: BASE_ZERONET_R2_ACCESS_KEY_ID / _SECRET_ACCESS_KEY
must be set in Vercel before this merges. loadSnapshots throws if any network
fails, so an unconfigured zeronet would 502 the whole endpoint, mainnet and
sepolia included.
@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
omni-ui Ready Ready Preview Aug 5, 2026 2:25pm

Request Review

Nothing caught #14 dropping zeronet from /api/snapshots. The page looked right,
every test passed, and the breakage only surfaced when zeronet nodes could not
sync from a snapshot.

Adds app/snapshots/networks.contract.test.ts, asserting the API surface rather
than the rendered page: every expected network is served, hiding one from the UI
is a `hiddenFromUi` flag rather than a deletion, each network carries the config
the loader needs, and ids/buckets/env prefixes stay unique. Verified it has
teeth by replaying #14's deletion — three assertions fail with messages naming
the missing network.

It also asserts each network's R2 env prefix appears in .env.example. Because
loadSnapshots throws when any network fails, a network added without documented
credentials 502s the whole endpoint, so this catches at PR time the config half
of a failure that otherwise only shows up in production.

Runs as its own `snapshots API contract` check so it can be required in branch
protection and is legible in the PR list. NETWORK_CONFIGS is exported read-only
for the test.
The contract test already runs in the `test` job — the separate job re-ran the
same nine assertions behind a second npm ci for no added enforcement. `test` is
the gate, and a failure there names the assertion and the missing network.

Keeps the test itself; documents the invariant under `test` in the README, where
it actually runs.
@montycheese
montycheese merged commit e2f3d80 into main Aug 5, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants